#ifndef _DATA
#define _DATA

/*************
 * GLOBAL
 *************/

const float PI = 3.14159265f;

const int dir[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; // left, right, up, down
const int dir_sqr[8][2] = {{-1,0},{1,0},{0,-1},{0,1},{-1,-1},{1,1},{-1,1},{1,-1}};
const int dir_star[13][2] = {{0,-2},{-1,-1},{0,-1},{1,-1},{-2,0},{-1,0},{1,0},{2,0},{-1,1},{0,1},{1,1},{0,2},{0,0}};

enum EDir { LEFT, RIGHT, UP, DOWN };

enum EMapType { MAP_NONE, MAP_WORLD, MAP_CITY, MAP_MAZE };

enum ETransition { TRANSITION_NONE, TRANSITION_ZOOM, TRANSITION_FADE };
enum ETransitionState { TRANSITION_STATE_OFF, TRANSITION_STATE_ON, TRANSITION_STATE_DONE };

enum EParticleEffect { PARTICLE_NONE, PARTICLE_SMOKE };
enum EWeatherEffect { WEATHER_NONE, WEATHER_RAIN, WEATHER_SNOW };
enum ELightSource { LIGHT_NONE, LIGHT_TORCH };

enum EMenu { MENU_NONE, MENU_CHARACTER_ACTION };
enum EMenuAction { ACTION_NONE, ACTION_ITEM_DROP, ACTION_ITEM_TAKE, ACTION_ITEM_BUY, ACTION_ITEM_STEAL,
	ACTION_ITEM_TAKE_ON, ACTION_ITEM_TAKE_OFF, ACTION_ITEM_DRINK, ACTION_TALK};

enum EQuestStatus { QUEST_STATUS_NONE,
	QUEST_STATUS_NEW, QUEST_STATUS_TAKEN, QUEST_STATUS_DONE = -1 };

enum EAlign { ALIGN_NONE, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER };
enum EFont { FONT_CHARACTER_NAME, FONT_CITY_NAME, FONT_GRID, FONT_HELP, FONT_MENU, FONT_TALK, FONT_LOADING,
	FONT_TITLE, FONT_TITLE_OPTIONS, FONT_CREDITS};

/*************
 * ITEMS
 *************/

enum EItem { ITEM_NONE,
	ITEM_DAILY, ITEM_CLOTH, ITEM_ARMOR, ITEM_QUEST, ITEM_WEAPON, ITEM_FOOD, ITEM_DRINK, ITEM_JEWELRY,
	ITEM_END
};
enum EDaily { DAILY_NONE,
	DAILY_LEATHER_GRIP, DAILY_JEWELRY_SACK, DAILY_SENTINELS_GLYPH, DAILY_BOUQET_OF_VOILETS,
	DAILY_ROCK, DAILY_WOODEN_LADLE, DAILY_BLACKSMITH_TONGS, DAILY_FLINT, DAILY_JEWELRY_BOX,
	DAILY_COFFER, DAILY_FLOWER_GARLAND, DAILY_CLAY_CUP, DAILY_METAL_JUG, DAILY_POT, DAILY_MUG, DAILY_SPOON, DAILY_TEA_SPOON,
	DAILY_TABLECLOTH, DAILY_QUILT, DAILY_PILLOW, DAILY_PLATE, DAILY_PAPER, DAILY_SCIZORS, DAILY_LIZARD, DAILY_SPOCK,
	DAILY_CANDLE, DAILY_SLEEPBAG, DAILY_SHORT_ROPE, DAILY_LONG_ROPE, DAILY_OLIVE, DAILY_STICK, DAILY_BANDAGE,
	DAILY_PORTABLE_TENT, DAILY_CPR_SCROLL, DAILY_PRAYER_BOOK, DAILY_PRAYER_SCARF, DAILY_SYMBOL_OF_THE_GODS,
	DAILY_MEDITATION_BLANKET, DAILY_WAX, DAILY_SAGE, DAILY_MINT, DAILY_ST_JOHNS_WORT, DAILY_TOADS_EYES,
	DAILY_LITTLE_EMPTY_FLASK,
	DAILY_END
};
enum ECloth { CLOTH_NONE,
	CLOTH_SHIRT, CLOTH_VEST, CLOTH_APRON_SMITH, CLOTH_DRESS, CLOTH_CASSOCK, CLOTH_APRON_HERB, 
	CLOTH_CHEMISE, CLOTH_TROUSERS, CLOTH_PANTS, CLOTH_SKIRT, CLOTH_PETTICOAT, CLOTH_KINGS_COAT, CLOTH_ARMOR, CLOTH_STRIP,
	CLOTH_BELT, CLOTH_HAT,
	CLOTH_END
};
enum EArmor { ARMOR_NONE,
	ARMOR_STEEL_BOOTS, ARMOR_DECORATED_BREASTPLATE, ARMOR_LEATHER, ARMOR_STUDDED, ARMOR_SHADOW,
	ARMOR_CHAINMAIL, ARMOR_GIRDLE, ARMOR_FULL_PLATE, ARMOR_HELMET,
	ARMOR_END
};
enum EQuest { QUEST_NONE,
	QUEST_FOXS_BODY, QUEST_LUCKY_RABBITS_FOOT, QUEST_FOUR_LEAF_CLOVER, QUEST_THE_PRZEDMIOT,
	QUEST_BLACKSMITH_HAMMER, QUEST_BUNCH_OF_HERBS, QUEST_HORSE_COLLAR, QUEST_UNCKLE_TOMS_PIPE,
	QUEST_OLD_RUINED_GRIMOIRE, QUEST_RECIPES, QUEST_SPARE_WHEEL, QUEST_SILVER_KETTLE, QUEST_BRIDLE, QUEST_BELLOWS,
	QUEST_BOOK_OF_FIRE, QUEST_GODS_TEARS,
	QUEST_END
};
enum EWeapon { WEAPON_NONE,
	WEAPON_FRENCH_WRENCH, WEAPON_BREAD_KNIFE, WEAPON_CHEESE_KNIFE, WEAPON_SWORD, WEAPON_AXE,
	WEAPON_MACE, WEAPON_FLAIL, WEAPON_HALBERD, WEAPON_MORNING_STAR, WEAPON_SHORT_SWORD, WEAPON_WAR_HAMMER, WEAPON_DAGGER,
	WEAPON_BATTLE_AXE,
	WEAPON_END
};
enum EFood { FOOD_NONE,
	FOOD_FRESH_QUARK_CHEESE, FOOD_CHEESECAKE, FOOD_BLUE_CHEESE, FOOD_SHEEP_CHEESE,
	FOOD_WHOLEMEAL_BREAD, FOOD_WHITE_BREAD, FOOD_ROLL, FOOD_PASSOVER_BREAD, FOOD_LARD_WITH_BACON_CRACKLINGS,
	FOOD_PATE, FOOD_PICKLED_CUCUMBERS, FOOD_TOMATO, FOOD_POTATOS, FOOD_CARROT, FOOD_CARROT_PIE, FOOD_SALT, FOOD_LETTUCE,
	FOOD_APPLE, FOOD_LEG_OF_LAMB, FOOD_PIG_SNOUT, FOOD_OX_LIVER, FOOD_DONKEYS_EARS, FOOD_HORSES_HOOVES,
	FOOD_END
};
enum EDrink { DRINK_NONE,
	DRINK_DARK_BEER, DRINK_LIGHT_BEER, DRINK_RED_WINE, DRINK_WHEAR_BEERM, DRINK_VODKA, DRINK_HOOCH,
	DRINK_POTION_OF_WISENESS, DRINK_POTION_OF_MINDLESS,	DRINK_POTION_OF_HORSE_TALK, DRINK_DUCK_POLYMORPHY_POTION,
	DRINK_LILIPUT_POTION, DRINK_SURPRISE_POTION,
	DRINK_END
};
enum EJewelry { JEWELRY_NONE,
	JEWELRY_COOPER_BRACELET, JEWELRY_LEATHER_BRACELET, JEWELRY_SILVER_BRACELET,
	JEWELRY_GOLD_BRACELET, JEWELRY_STRAP_NECKLACE, JEWELRY_SILVER_NECKLACE, JEWELRY_LITTLE_EARRING,
	JEWELRY_YADEIT_RING, JEWELRY_CLAY_RING, JEWELRY_SILVER_RING, JEWELRY_WEDDING_RING,
	JEWELRY_END
};

struct Node{
	int x;
	int y;

	bool operator==(const Node& n) {return (x == n.x && y == n.y);};
	bool operator!=(const Node& n) {return (x != n.x || y != n.y);};
	bool operator<(const Node& n) const {return (x < n.x ? true : (x > n.x ? false : y < n.y));};
};

struct Point{
	float x;
	float y;

	bool operator==(const Point& n) {return (x == n.x && y == n.y);};
	bool operator!=(const Point& n) {return (x != n.x || y != n.y);};
	Point operator=(const Node& n)
	{
		Point p;
		p.x = (float)(n.x);
		p.y = (float)(n.y);
		return p;
	}
};

/*************
 * WORLD
 *************/

enum EGenerator {
	ALEXANDER, PERLIN
};

enum EBiome {
	UNDEF, NONE, WATER, LAND,
	OCEAN, LAKE, COAST,
	SAVANNA, TROPIC, TAIGA, DESERT, FOREST, TUNDRA, STEPPE, SCLEROPHYLL, POLAR,
	BIOME_END
};

enum ETerrain {
	EMPTY, TNONE, OCCUPIED,
	RIVER, CONFLUENCE, BRIDGE, TREE, MOUNTAIN, CITY, ROAD, WROAD, PORT,
	TERRAIN_END
};

/*************
 * CITY, MAZE
 *************/

enum EFloor {
	FLOOR_NONE,
	F_STONE, F_CARPET, F_WOOD, F_MARKET, F_SOIL,
	FLOOR_END
};

enum EObject {
	OBJECT_NONE,
	O_ROAD, O_WALL, O_TREE, O_GRAVE, O_FENCE, O_MARKETSTAND, O_WELL,
	O_SIGN_WEAPON, O_SIGN_ARMOR, O_SIGN_HERB, O_SIGN_INN,
	O_BED, O_TABLE, O_CHAIR, O_WARDROBE,
	O_OVEN, O_BARREL,
	O_BOOKCASE,
	O_THRONE, O_ARMOR, O_CANDLESTICK, O_PLANT,
	O_ALTAR, O_BENCH, O_RECEPTION,
	O_FURNACE, O_ANVIL, O_BUCKET, O_HERBSTAND, O_POT, O_CHEST, O_CRATE,
	O_TORCH, O_LADDER,
	OBJECT_END
};

enum EBuilding{
	BUILDING_NONE,
	B_PALACE, B_TEMPLE,
	B_WEAPONSHOP, B_ARMORSHOP, B_HERBSHOP,
	B_INN, B_HOUSE, B_GRAVEYARD, B_MARKET,
	BUILDING_END,

	ROOM_NONE,
	R_BEDROOM, R_KITCHEN, R_SALON, R_WAREHOUSE,
	ROOM_END
};

enum EMazeGenerator{
	MAZEGENERATOR_NONE
};

/*************
 * CHARACTERS
 *************/

enum ERace{ RACE_BLACK, RACE_WHITE, RACE_NORD, RACE_END };
enum EAge { AGE_CHILD, AGE_TEEN, AGE_MATURE, AGE_OLD, AGE_END};
enum EJob { JOB_NONE, JOB_UNEMPLOYED, JOB_SOLDIER, JOB_WEAPONSMITH, JOB_ARMORSMITH, JOB_BARTENDER, JOB_HERBALIST,
						JOB_KING, JOB_PRIEST, JOB_SELLER, JOB_CHEF, JOB_WORKER, JOB_END};
enum EMood { MOOD_NONE, MOOD_HAPPY, MOOD_SAD, MOOD_ANGRY, MOOD_SUPRISED, MOOD_LAUGH, MOOD_END};
enum EHairC { HAIR_BLONDE, HAIR_BROWN, HAIR_BLACK, HAIR_RED, HAIR_WHITE};
enum EHairM { HAIR_BALD, HAIR_UNDERCUT, HAIR_MOHAWK, HAIR_SHORT, HAIRM_END};
enum EHairF { HAIR_ODANGO, HAIR_HIME, HAIR_PIGTAILS, HAIR_LONG, HAIRF_END};
enum EAnimation { ANIMATION_NONE, ANIMATION_WALK_LEFT, ANIMATION_WALK_RIGHT, ANIMATION_WALK_UP, ANIMATION_WALK_DOWN};

/*************
 * STRUCTURES
 *************/

struct Tile{
	int lower;
	int upper;
	int seed;
	bool passable;
	int spawn;

	Tile() : 
		lower(0),
		upper(0),
		seed(0),
		passable(false),
		spawn(0){}
};

struct sRectangle{
	int x1;
	int y1;
	int x2;
	int y2;
	bool occupied;

	void operator()(int aX1, int aY1, int aX2, int aY2);
	inline int area(){ return ((x2-x1) * (y2-y1));}
	inline bool isVertical(){ return (y2 - y1 > x2 - x1);}
};

#endif